package com.zzty.txj1.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.zzty.txj1.config.WeiChatConfig;
import com.zzty.txj1.entity.Clazz;
import com.zzty.txj1.entity.User;
import com.zzty.txj1.service.ClazzService;
import com.zzty.txj1.util.HttpUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class ClazzServiceImpl implements ClazzService {
    @Value("${url.clazz.getAllClazz}")
    private String getAllClazz;
    @Override
    public List<Clazz> getAllClazz() {
        List<Clazz> clazzes=new ArrayList<Clazz>();
        try{
            String result=HttpUtil.httpGet(WeiChatConfig.urlToUser+getAllClazz);
            clazzes=JSONObject.parseArray(result,Clazz.class);
        }catch (Exception e){
            e.printStackTrace();
        }
        return clazzes;
    }
}
